/*
 * Copyright 2007 National Bioinformatics Network
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package dgbgui.gui.dialogs;

import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JPanel;

import dgbgui.tools.DialogedTool;

@SuppressWarnings("serial")
public class ClosureDialog extends DGBGUIDialog {
    
    
    public ClosureDialog(DialogedTool tool) {
        super(tool,"Closure");
        setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));

        // From
        add(m_fromPanel = new ComboBoxPanel("From"));

        // The depth box
        add(m_closureTypePanel = new ComboBoxPanel("Closure type"));

        // The layer panel
        add(m_layerPanel = new ComboBoxPanel("In layer"));
        
        // The relation panel
        add(m_relationPanel = new ComboBoxPanel("Through relations"));

        // Add the OK and Cancel buttons
        JPanel buttonsPanel = new JPanel();
        buttonsPanel.setLayout(new BoxLayout(buttonsPanel,BoxLayout.X_AXIS));
        m_okButton = new JButton("OK");
        m_cancelButton = new JButton("Cancel");
        buttonsPanel.add(m_okButton);
        buttonsPanel.add(m_cancelButton);

        m_okButton.addActionListener(tool);
        m_cancelButton.addActionListener(tool);

        add(buttonsPanel);
    }
    

    // From
    
    public DefaultComboBoxModel getFromModel() {
        return m_fromPanel.getModel();
    }
    public void setFromModel(DefaultComboBoxModel model) {
        m_fromPanel.setModel(model);
    }    
    
    // Closure Type
    
    public DefaultComboBoxModel getClosureTypeModel() {
        return m_closureTypePanel.getModel();
    }
    public void setClosureTypeModel(DefaultComboBoxModel model) {
        m_closureTypePanel.setModel(model);
    }
    
    // Layer

    public DefaultComboBoxModel getLayerModel() {
        return m_layerPanel.getModel();
    }
    public void setLayerModel(DefaultComboBoxModel model) {
        m_layerPanel.setModel(model);
    }
    
    // Relation

    public DefaultComboBoxModel getRelationModel() {
        return m_relationPanel.getModel();
    }
    public void setRelationModel(DefaultComboBoxModel model) {
        m_relationPanel.setModel(model);
    }

    
    private ComboBoxPanel m_closureTypePanel;
    private ComboBoxPanel m_fromPanel;
    private ComboBoxPanel m_layerPanel;
    private ComboBoxPanel m_relationPanel;
    

}
